package com.kedacom.gsyvideoplayer

import android.media.MediaPlayer
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import kotlinx.android.synthetic.main.activity_gsy_video_play.*
import kotlinx.android.synthetic.main.video_layout.view.*

/**
 * 基于MediaPlayer封装的播放器；
 * 1、没有操作工具栏
 * 2、只适合电视盒子的视频播放，通过遥控器来控制；
 * 3、具体使用参考【点播系统】：https://szgitlab.kedacom.com/AndroidTechTeam/vodsystem
 * 4、参考：com.kedacom.vodsystem.view.activity.OnDemandDetailActivity
 */
class SuperVideoViewDemoActivity : AppCompatActivity(), IVideoPlayCallBack {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_supervideoview_demo)

        videoPlayer.register(this@SuperVideoViewDemoActivity)
        videoPlayer.setVideoViewCallBack(this@SuperVideoViewDemoActivity)
        videoPlayer.rootPlayView.btn_screen.setOnClickListener {
            Log.d("caowj", "全屏")
        }

//        val temp = "/storage/emulated/0/Quark/Download/210810094303VID_20210810_093643.mp4"
//        val temp =
//            "http://192.168.20.180/pacc/attachment/v1/paccFileDownload?filePath=2021-08-16/210816092644210810094303VID_20210810_093643.mp4"
        val temp = "http://vfx.mtime.cn/Video/2019/03/12/mp4/190312143927981075.mp4"
        videoPlayer.setVideoPath(temp)
    }

    override fun onPreparedListener(mp: MediaPlayer?) {
        Log.d("caowj", "onPreparedListener")
    }

    override fun onCompletionListener(mp: MediaPlayer?) {
        Log.d("caowj", "onCompletionListener")
    }

    override fun onInfoListener(mp: MediaPlayer?, what: Int, extra: Int) {
        Log.d("caowj", "onInfoListener")
    }

    override fun onErrorListener(mp: MediaPlayer?, what: Int, extra: Int) {
        Log.d("caowj", "onErrorListener")
    }
}